var LookUpHospID="null"; // LookUpSysUser.tag中使用
/**
 * 初始化业务用户详情对话框
 */
var CdcUserInfoDlg = {
    validateFields: {
    	xcode: {
            validators: {
                notEmpty: {
                    message: '索引码不能为空'
                }
            }
        },
    	code: {
            validators: {
                notEmpty: {
                    message: '工号不能为空'
                }
            }
        },
    	name: {
            validators: {
                notEmpty: {
                    message: '姓名不能为空'
                }
            }
        },
    	busUserTypeId: {
            validators: {
                notEmpty: {
                    message: '医护类型不能为空'
                }
            }
        },
    	busUserLevelId: {
            validators: {
                notEmpty: {
                    message: '职称(级别)不能为空'
                }
            }
        },
    	dataId: {
            validators: {
                notEmpty: {
                    message: '业务数据类型不能为空'
                }
            }
        },
    	isActive: {
            validators: {
                notEmpty: {
                    message: '是否有效不能为空'
                }
            }
        },
    }
};


/**
 * 关闭此对话框
 */
CdcUserInfoDlg.close = function() {
    parent.layer.close(parent.layer.getFrameIndex(window.name)); //先得到当前iframe层的索引,再执行关闭   
}

/**
 * 验证数据是否为空
 */
CdcUserInfoDlg.validate = function () {
    $('#cdcUserInfoForm').data("bootstrapValidator").resetForm();
    $('#cdcUserInfoForm').bootstrapValidator('validate');
    return $("#cdcUserInfoForm").data('bootstrapValidator').isValid();
}

/**
 * 提交新增
 */
CdcUserInfoDlg.addSubmit = function() {

    if (!this.validate()) {
        return;
    }
    //提交信息
    Sys.ajaxForm('cdcUserInfoForm',Sys.backendPath + "/cdc/cdcuser/add",function(res) {
        Sys.success(res.message);
    	window.parent.CdcUser.table.refresh();
        CdcUserInfoDlg.close();
    });
}

/**
 * 提交修改
 */
CdcUserInfoDlg.editSubmit = function() {

    if (!this.validate()) {
        return;
    }
    //提交信息
    Sys.ajaxForm('cdcUserInfoForm',Sys.backendPath + "/cdc/cdcuser/update",function(res) {
        Sys.success(res.message);
    	window.parent.CdcUser.table.refresh();
        CdcUserInfoDlg.close();
    });
}

$(function() {
	Sys.initValidator("cdcUserInfoForm", CdcUserInfoDlg.validateFields);
    $("#dataId").combobox("disable");
    $("#dataId").combobox('setValue', window.parent.CdcUser.sysDataId);
    LookUpSysOrgID=window.parent.CdcUser.sysOrgId;
});
